import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [
    vue()
  ],
  server: {
    port: 9999,
    host: "0.0.0.0",
    proxy: {
      '/modelApi': {
        target: 'http://www.yx772.com/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/modelApi/, '')
      },
      "/fanyi-api": {
        target: "https://fanyi-api.baidu.com", //跨域地址
        changeOrigin: true, //支持跨域
        rewrite: (path) => path.replace(/^\/fanyi-api/, ""), //重写路径,替换/back-api
      },
      "/fanyi-pp-api": {
        target: "https://api.pencil-stub.com", //跨域地址
        changeOrigin: true, //支持跨域
        rewrite: (path) => path.replace(/^\/fanyi-pp-api/, ""), //重写路径,替换/back-api
      },

      "/file-pencil": {
        target: "https://imgs.pencil-stub.com", //跨域地址
        changeOrigin: true, //支持跨域
        rewrite: (path) => path.replace(/^\/file-pencil/, ""), //重写路径,替换/file-pencil
      },
      "/testApi": {
        target: "https://www.wedraw.art", //跨域地址
        changeOrigin: true, //支持跨域
        rewrite: (path) => path.replace(/^\/testApi/, ""), //重写路径,替换/file-pencil
      },
    }
  },
})
